/**
 * 
 */
package barney.davis.hume.it3048todo.service;

import java.util.ArrayList;
import java.util.Calendar;

import barney.davis.hume.it3048todo.constants.TaskStatus;
import barney.davis.hume.it3048todo.dto.Task;

/**
 * @author Adam
 * 
 */
public interface ITaskService {

	/**
	 * Saves task. Calls TaskDAO.save()
	 * 
	 * @param task
	 *            The task to be saved
	 * @throws Exception
	 *             Any issues with saving the task
	 */
	public void saveTask(Task task) throws Exception;

	/**
	 * Returns all tasks.
	 * 
	 * @return All tasks
	 * @throws Exception
	 *             Should only throw an exception when there are no tasks in the
	 *             database
	 */
	public ArrayList<Task> getTasks() throws Exception;

	/**
	 * Returns all tasks due on the given date.
	 * @param dueDate For best results, use GregorianCalendar.
	 * @return All tasks due on the given date.
	 * @throws Exception Any errors
	 */
	public ArrayList<Task> getTasks(Calendar dueDate) throws Exception;

	/**
	 * Returns all tasks due between the two given dates (inclusive).
	 * @param startDate The first due date in the range. Use GregorianCalendar for best results.
	 * @param endDate The last due date in the range. Use GregorianCalendar for best results.
	 * @return All tasks due between the given dates (inclusive).
	 * @throws Exception Any errors
	 */
	public ArrayList<Task> getTasks(Calendar startDate, Calendar endDate)
			throws Exception;

	/**
	 * Returns all tasks with the given status
	 * @param status
	 * @return All tasks with the given status
	 * @throws Exception any errors
	 */
	public ArrayList<Task> getTasks(TaskStatus status) throws Exception;

	/**
	 * Deletes the given task
	 * @param task The task to be deleted
	 * @throws Exception
	 */
	public void deleteTask(Task task) throws Exception;

	/**
	 * Fetches the task using ID
	 * @param string ID of the task to be fetched
	 * @return Task
	 * @throws Exception
	 */
	public Task getTaskById(String id) throws Exception;

}
